package com.example.vv.config;

import java.util.concurrent.Executor;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

// @Configuration
public class AsyncConfig implements AsyncConfigurer {

    @Resource
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    public AsyncConfig() {
        System.err.println(123);
    }

    @Override
    public Executor getAsyncExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        executor.setCorePoolSize(5);
        executor.setMaxPoolSize(10);
        executor.setQueueCapacity(25);
        executor.setThreadNamePrefix("Async-");
        executor.initialize();
        return executor;
    }
}
